package 美团;

import 树.TreeNode;

import java.util.LinkedList;
import java.util.List;

public class _94_二叉树的中序遍历 {
    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> res = inorder(root, new LinkedList<Integer>());
        return res;
    }

    private List<Integer> inorder(TreeNode root, LinkedList<Integer> res) {
        if (root == null) return res;
        inorder(root.left, res);
        res.add(root.val);
        inorder(root.right, res);
        return res;
    }
}
